Lightweight macOS WebDAV Server Setup

This guide details how to set up a lightweight, persistent WebDAV server on macOS using rclone. It configures the server to be accessible on the local network (subnet), require a username and password, run on a custom port, and automatically start in the background when logging into the Mac.


1. Manual Testing (The Command Line)

Before making the server permanent, it's good practice to test the command to ensure it runs as expected.

The Command:

rclone serve webdav /Users/zsk009/Public --addr 0.0.0.0:9000 --user myuser --pass mypassword

What the flags do:

Note: You can find your Mac's local IP address to connect from other devices by running ipconfig getifaddr en0.


2. Making it Permanent (launchd)

To run the server in the background, start it automatically on login, and restart it if it crashes, we use a macOS launchd Property List (.plist) file.

Step 2.1: Locate your rclone binary

Run the following command to find exactly where rclone is installed on your system:

which rclone

(Common paths are /opt/homebrew/bin/rclone or /usr/local/bin/rclone)

Step 2.2: Create the .plist file

Create a new configuration file in your user's LaunchAgents directory:

nano ~/Library/LaunchAgents/com.zsk009.webdav.plist

Paste the following XML into the file. Important: Verify that the first <string> under ProgramArguments matches the output of your which rclone command.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.zsk009.webdav</string>

    <key>ProgramArguments</key>
    <array>
        <!-- Absolute path to rclone executable -->
        <string>/opt/homebrew/bin/rclone</string> 
        <string>serve</string>
        <string>webdav</string>
        <!-- The folder to share -->
        <string>/Users/zsk009/Public</string> 
        <string>--addr</string>
        <string>0.0.0.0:9000</string>
        <string>--user</string>
        <string>myuser</string>
        <string>--pass</string>
        <string>mypassword</string>
    </array>

    <key>RunAtLoad</key>
    <true/>

    <key>KeepAlive</key>
    <true/>

    <key>StandardErrorPath</key>
    <string>/Users/zsk009/Library/Logs/rclone-webdav.log</string>
    <key>StandardOutPath</key>
    <string>/Users/zsk009/Library/Logs/rclone-webdav.log</string>
</dict>
</plist>

Save and exit (Ctrl+O, Return, Ctrl+X if using nano).


3. Managing the Service

Once the .plist file is created, you use launchctl to manage the background process.

Start the server (load the service):

launchctl load ~/Library/LaunchAgents/com.zsk009.webdav.plist

Stop the server (unload the service):

launchctl unload ~/Library/LaunchAgents/com.zsk009.webdav.plist

View the server logs (monitor connections or errors):

tail -f ~/Library/Logs/rclone-webdav.log